from rest_framework import serializers
from . import models
from user.models import User
class CategorySerializers(serializers.ModelSerializer):
    class Meta:
        model = models.Department
        fields = ['name','id']

class UserSerializers(serializers.ModelSerializer):
    class Meta:
        model = User
        fields=['first_name','last_name','icon']

#子序列化
class SharerSerializers(serializers.ModelSerializer):
    user=UserSerializers()
    class Meta:
        model = models.Sharer
        fields = ['name','title','user','presentation']

class Detail_PageSerializers(serializers.ModelSerializer):
    class Meta:
        model = models.Detail_Page
        fields = ['synopsis','video_link','faq','document_link','vcs']

class CompleteSerializers(serializers.ModelSerializer):
    sharer=SharerSerializers()
    detail_page=Detail_PageSerializers()
    class Meta:
        model = models.Share_Content
        fields = ['name','cover','cumulative_clicks','release_time','sharer','id','detail_page']


